home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 2.00 Begin Form Form1 BackColor = &H00E0E0E0& Caption = "Run This Program As An EXE File For Best Results" ClientHeight = 5460 ClientLeft = 855 ClientTop = 1500 ClientWidth = 7845 Height = 5865 Left = 795 LinkMode = 1 'Source LinkTopic = "Form1" ScaleHeight = 364 ScaleMode = 3 'Pixel ScaleWidth = 523 Top = 1155 Width = 7965 Begin ListBox ShoppingList BackColor = &H00FFFF00& Height = 1785 Left = 360 TabIndex = 8 Top = 3240 Width = 1455 End Begin PictureBox FindPic BackColor = &H00C0C0C0& Height = 1695 Left = 3720 ScaleHeight = 111 ScaleMode = 3 'Pixel ScaleWidth = 239 TabIndex = 13 Top = 3120 Visible = 0 'False Width = 3615 Begin CommandButton Command2 Caption = "Cancel" Height = 375 Left = 2760 TabIndex = 17 Top = 1200 Width = 735 End Begin CommandButton Command1 Caption = "OK" Height = 375 Left = 1920 TabIndex = 16 Top = 1200 Width = 735 End Begin CheckBox Check2 BackColor = &H00C0C0C0& Caption = "Whole Word" Height = 375 Left = 240 TabIndex = 21 Top = 1200 Width = 1575 End Begin CheckBox Check1 BackColor = &H00C0C0C0& Caption = "Case Sensitive" Height = 375 Left = 240 TabIndex = 19 Top = 840 Width = 1575 End Begin TextBox FindTextBox Height = 285 Left = 1020 TabIndex = 14 Top = 345 Width = 2385 End Begin PictureBox FindTitle BackColor = &H009A6049& Height = 255 Left = -15 ScaleHeight = 15 ScaleMode = 3 'Pixel ScaleWidth = 239 TabIndex = 15 Top = -15 Width = 3615 End Begin Label Label3 Alignment = 1 'Right Justify BackColor = &H00C0C0C0& Caption = "Find What:" Height = 255 Left = 0 TabIndex = 18 Top = 390 Width = 975 End End Begin PictureBox PyramidPic AutoSize = -1 'True Height = 495 Index = 2 Left = 4080 ScaleHeight = 31 ScaleMode = 3 'Pixel ScaleWidth = 39 TabIndex = 12 Top = 1680 Visible = 0 'False Width = 615 End Begin ListBox MeatList Height = 1590 Left = 360 Sorted = -1 'True TabIndex = 4 Top = 1200 Visible = 0 'False Width = 1455 End Begin PictureBox PyramidPic AutoSize = -1 'True Height = 495 Index = 1 Left = 4080 ScaleHeight = 31 ScaleMode = 3 'Pixel ScaleWidth = 39 TabIndex = 11 Top = 960 Visible = 0 'False Width = 615 End Begin ListBox VegList Height = 1590 Left = 720 Sorted = -1 'True TabIndex = 5 Top = 960 Visible = 0 'False Width = 1455 End Begin ListBox FruitList Height = 1590 Left = 1080 Sorted = -1 'True TabIndex = 6 Top = 720 Visible = 0 'False Width = 1455 End Begin ListBox PastryList Height = 1590 Left = 1440 Sorted = -1 'True TabIndex = 7 Top = 480 Visible = 0 'False Width = 1455 End Begin PictureBox WindowPic BackColor = &H00808080& Height = 2655 Left = 4800 ScaleHeight = 175 ScaleMode = 3 'Pixel ScaleWidth = 167 TabIndex = 0 Top = 240 Width = 2535 Begin CommandButton ChessHelpCmdBut Caption = "Help" Height = 375 Left = 960 TabIndex = 2 Top = 2160 Visible = 0 'False Width = 735 End Begin PictureBox ChessPic AutoSize = -1 'True Height = 615 Left = 0 ScaleHeight = 39 ScaleMode = 3 'Pixel ScaleWidth = 55 TabIndex = 1 Top = 0 Visible = 0 'False Width = 855 End End Begin PictureBox PyramidPic AutoSize = -1 'True Height = 495 Index = 0 Left = 4080 ScaleHeight = 31 ScaleMode = 3 'Pixel ScaleWidth = 39 TabIndex = 3 Top = 240 Visible = 0 'False Width = 615 End Begin Label Label4 Alignment = 2 'Center BackColor = &H000000FF& BorderStyle = 1 'Fixed Single Caption = "Drag FIND Box Around By Its Title Bar" Height = 255 Left = 3720 TabIndex = 20 Top = 4920 Width = 3615 End Begin Label Label1 Alignment = 2 'Center BackColor = &H00C0C0C0& BorderStyle = 1 'Fixed Single Caption = "Shopping List" Height = 255 Left = 360 TabIndex = 9 Top = 3000 Width = 1455 End Begin Label Label2 Alignment = 2 'Center BackColor = &H000000FF& BorderStyle = 1 'Fixed Single Caption = "Use Lists To Build A Shopping List" Height = 255 Left = 120 TabIndex = 10 Top = 120 Width = 3375 End '========================================================= ' CLPSIB.BAS Rev. 1.0 ' Keith Funk (CIS 72240, 2020) ' Nov. 3, 1991 ' Many thanks to Daniel Appleman (Desaware) for explaining ' the Win3 WS_CLIPSIBLINGS style without which this program ' could not have been written. I'd also like to thank ' Ted Young and Jonathan Zuk for the help they have given ' me in learning the Win3 API. ' The purpose of the program is to demonstrate how to ' implement overlapping controls in a VB program. ' NOTE that the Form and all controls have their ScaleMode set ' to PIXELS. Also, AutoRedraw is False for all controls. The ' Picture Controls that contain the bitmaps PYRAMID.BMP ' and CHESS.BMP have AutoSize set to True. No other control ' properties have any particular relevance for this demo. ' The program is FREEWARE. Feel free to use any part of ' it in your own programs. Feedback and comments would ' be appreciated. Have fun. '========================================================= '-- Declarations for external functions. ' CTLHWND.DLL is a custom DLL written by Jonathan Zuk. It ' is included, with thanks to Jonathan, as part of CLPSIB. Declare Function ControlhWnd Lib "ctlhwnd.dll" (Ctl As Control) As Integer Declare Sub BringWindowToTop Lib "User" (ByVal hWnd As Integer) Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal wCmd As Integer) As Integer Declare Function GetNextWindow Lib "User" (ByVal hWnd As Integer, ByVal wFlag As Integer) As Integer Declare Function GetWindowLong Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer) As Long Declare Function SetWindowLong Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Long) As Long Declare Function GetWindowsDirectory Lib "Kernel" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer Declare Function OpenFile Lib "Kernel" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Integer) As Integer '-- Window style. Const WS_CLIPSIBLINGS = &H4000000 '-- THE SECRET TO SUCCESS<g> '-- SetWindowPos Flags Const SWP_NOSIZE = &H1 Const SWP_NOMOVE = &H2 Const SWP_NOZORDER = &H4 Const SWP_NOREDRAW = &H8 Const SWP_NOACTIVATE = &H10 Const SWP_DRAWFRAME = &H20 Const SWP_SHOWWINDOW = &H40 Const SWP_HIDEWINDOW = &H80 Const SWP_NOCOPYBITS = &H100 Const SWP_NOREPOSITION = &H200 '-- GetWindow() Constants Const GW_HWNDFIRST = 0 Const GW_HWNDLAST = 1 Const GW_HWNDNEXT = 2 Const GW_HWNDPREV = 3 Const GW_OWNER = 4 Const GW_CHILD = 5 '-- Window field offsets for GetWindowLong() and GetWindowWord() Const GWL_WNDPROC = (-4) Const GWW_HINSTANCE = (-6) Const GWW_HWNDPARENT = (-8) Const GWW_ID = (-12) Const GWL_STYLE = (-16) Const GWL_EXSTYLE = (-20) '-- OpenFile action. Const OF_EXIST = &H4000 Const True = -1 Const False = 0 '-- The mouse location when the mouse button is initially pressed. Dim XStart As Single Dim YStart As Single '-- Flags to indicate when a picture can be moved. A move ' is not allowed while a DoEvents is in progress. Dim OkToMoveChessPic As Integer Dim OkToMovePyramidPic As Integer Dim OkToMoveFindPic As Integer '-- Keeps track of the location of the list boxes in the ' window stack. Dim TopListBox As Integer Dim PrecedingListBox As Integer '-- Flag to determine if user clicked a listbox to make ' a selection or just to bring it to the front. Dim ClickedToGetFocus As Integer '--------------------------------------------------------- ' This routine brings ThisList to the top of the window ' stack so it appears on top of the other listboxes. ' It also sets some global variables that keep track of ' the current order of the window stack. '--------------------------------------------------------- Sub BringToTop (ThisList As Control) '-- If ThisList is already at the top then there's nothing to do. If ControlhWnd(ThisList) = TopListBox Then Exit Sub '-- Put the listbox that is currently on top back in its proper location. ' Note that we don't need to specify x,y,cx and cy because the flags ' SWP_NOMOVE and SWP_NOSIZE tell Win3 to ignore these values. Call SetWindowPos(TopListBox, PrecedingListBox, 0, 0, 0, 0, (SWP_NOMOVE Or SWP_NOSIZE)) '-- Find out which window precedes ThisList in the window stack. PrecedingListBox = GetNextWindow(ControlhWnd(ThisList), GW_HWNDPREV) '-- Move this listbox to the front of the group of ' listboxes *BUT* behind the FindPic control. We are ' demonstrating how a control (FindPic) can *always* ' remain in front of all other controls even when ' these controls are being re-arranged. TopListBox = ControlhWnd(ThisList) Call SetWindowPos(TopListBox, ControlhWnd(FindPic), 0, 0, 0, 0, (SWP_NOSIZE Or SWP_NOMOVE)) '-- Tell Click Event to ignore this click because ' user is just bringing the list to the front. ClickedToGetFocus = True End Sub '--------------------------------------------------------- ' The main purpose of this control is to demonstrate ' how setting the WS_CLIPSIBLINGS style bit allows you ' to slide a picture underneath another control. NOTE ' that this control has been placed on the WindowPic ' control. It is *not* on Form1. '--------------------------------------------------------- Sub ChessHelpCmdBut_Click () MsgBox "Use the LEFT Mouse Button to drag the small pictures on top of CHESS.BMP and to scroll CHESS.BMP.", 64, "Chess Help" End Sub '--------------------------------------------------------- ' This control is filled with the bitmap CHESS.BMP ' during the Form1_Load Event. Because its AutoSize ' Property is set to True, it becomes much larger than ' the WindowPic control on which it is placed, but you ' can only see the area of CHESS.BMP that is within ' the boundaries of WindowPic. However, you can use your ' mouse to -move- different parts of CHESS.BMP into the ' visible area. NOTE how the picture -slides under- the ' Help Command Button. Too neat.<g> ' This is where the moving of CHESS.BMP begins. It is ' continued in the MouseMove Event. '--------------------------------------------------------- Sub ChessPic_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single) '-- Save mouse X/Y so MouseMove can determine how far ' the mouse has moved. XStart = X: YStart = Y '-- Set flag for MouseMove. OkToMoveChessPic = True End Sub '--------------------------------------------------------- ' This is the routine that actually moves CHESS.BMP. ' Note that the flag OkToMoveChessPic and the DoEvents ' are *absolutely* essential to the correct operation ' of this routine. '--------------------------------------------------------- Sub ChessPic_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single) '-- Only move the picture if left button is down. If Button = 1 Then '-- Only move the picture if no DoEvent is in progress. If OkToMoveChessPic = True Then OkToMoveChessPic = False ChessPic.Move (ChessPic.Left + X - XStart), (ChessPic.Top + Y - YStart) q% = DoEvents() OkToMoveChessPic = True '-- DoEvents has finished. End If End If End Sub '-------------------------------------------------------- ' In a -real- program, this button would activate the ' code to find text. '-------------------------------------------------------- Sub Command1_Click () MsgBox "You Actually Expected Something To Happen?<g>", 0, " " End Sub '--------------------------------------------------------------------------- ' Fills the meat, vegetable, fruit and pastry lists with goodies. '--------------------------------------------------------------------------- Sub FillLists () '-- Fill the Meat List. MeatList.AddItem "Rib Roast" MeatList.AddItem "Pork Chops" MeatList.AddItem "Chicken" MeatList.AddItem "Ground Beef" MeatList.AddItem "Lamb Chops" MeatList.AddItem "Spare Ribs" MeatList.AddItem "Pigs Feet" MeatList.AddItem "Sausage" MeatList.AddItem "Hot Dogs" '-- Fill the Vegetable List. VegList.AddItem "Potatoes" VegList.AddItem "Onions" VegList.AddItem "Corn" VegList.AddItem "Peas" VegList.AddItem "Turnip" VegList.AddItem "Carrots" VegList.AddItem "Yams" VegList.AddItem "Beans" VegList.AddItem "Eggplant" VegList.AddItem "Celery" '-- Fill the Fruit List FruitList.AddItem "Apples" FruitList.AddItem "Oranges" FruitList.AddItem "Pears" FruitList.AddItem "Grapes" FruitList.AddItem "Melons" FruitList.AddItem "Lemons" FruitList.AddItem "Limes" FruitList.AddItem "Apricots" FruitList.AddItem "Quinces" FruitList.AddItem "Plums" FruitList.AddItem "Peaches" '-- Fill the Pastry List PastryList.AddItem "Donuts" PastryList.AddItem "Bread" PastryList.AddItem "Buns" PastryList.AddItem "Crullers" PastryList.AddItem "Cherry Pie" PastryList.AddItem "Lemon Cake" PastryList.AddItem "Cookies" PastryList.AddItem "Macaroons" PastryList.AddItem "Muffins" PastryList.AddItem "Brownies" PastryList.AddItem "Date Squares" PastryList.AddItem "Peach Pie" End Sub '--------------------------------------------------------------------------- ' This Picture Control acts as a dark blue title bar for the FindPic ' Picture Control. Its purpose is to allow FindPic and all its child ' windows to be dragged around the Form. ' NOTE: That FindPic *always* appears on top of any other control. ' Very desireable for a Find Dialog Box. '--------------------------------------------------------------------------- Sub FindTitle_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single) '-- Save mouse X/Y so MouseMove can determine how far ' the mouse has moved. XStart = X: YStart = Y '-- Set flag for MouseMove. OkToMoveFindPic = True End Sub '--------------------------------------------------------------------------- ' This is the routine that actually drags FindPic around. '--------------------------------------------------------------------------- Sub FindTitle_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single) '-- Only move the picture if left button is down. If Button = 1 Then '-- Only move the picture if no DoEvent is in progress. If OkToMoveFindPic = True Then OkToMoveFindPic = False FindPic.Move (FindPic.Left + X - XStart), (FindPic.Top + Y - YStart) q% = DoEvents() OkToMoveFindPic = True '-- DoEvents has finished. End If End If End Sub Sub Form_Load () Dim WinDir As String Dim ChessBmp As String Dim PyramidBmp As String '-- Display hourglass mousepointer. Screen.MousePointer = 11 '-- Show the window centered on the screen. Form1.Left = (Screen.Width - Form1.Width) / 2 Form1.Top = (Screen.Height - Form1.Height) / 2 Form1.Show '********************************************************************** '* THIS IS THE KEY TO THE ENTIRE DEMO. TRY COMMENTING OUT * '* THE CALL TO SetClipSiblings AND WATCH THE PROGRAM FALL TO PIECES.* '******************************************************************** * '-- Set the CLIPSIBLING Style bit for all child windows. Call SetClipSiblingBit(Form1.hWnd) '---------------------------------------------------- ' SET UP THE CHESS.BMP CONTROLS. '---------------------------------------------------- '-- Find the Win3 directory and append a backslash. WinDir = Space$(144) r% = GetWindowsDirectory(WinDir, 144) If r% = 0 Then MsgBox "Can't Find Window's Directory", 0, "Fatal Error" End Else WinDir = Left$(WinDir, r%) '-- Strip trailing \0. If Right$(WinDir, 1) <> "\" Then WinDir = WinDir + "\" End If End If '-- If CHESS.BMP exists, load it into ChessPic. ChessBmp = WinDir + "CHESS.BMP" + Chr$(0) If OpenFile(ChessBmp, Buffer, OF_EXIST) = -1 Then MsgBox "Sorry, This Program Requires The Win3 Bitmap CHESS.BMP.", 0, "FATAL ERROR" End Else ChessPic.Picture = LoadPicture(ChessBmp) End If '-- Put the Command Button for CHESS.BMP on top of the ' Chess Picture, so the picture can be scrolled ' underneath it. Call BringWindowToTop(ControlhWnd(ChessHelpCmdBut)) '-- If PYRAMID.BMP exists, load it into the three PyramidPic controls. PyramidBmp = WinDir + "PYRAMID.BMP" + Chr$(0) If OpenFile(PyramidBmp, Buffer, OF_EXIST) = -1 Then MsgBox "Sorry, This Program Requires The Win3 Bitmap PYRAMID.BMP.", 0, "FATAL ERROR" End Else For I% = 0 To 2 PyramidPic(I%).Picture = LoadPicture(PyramidBmp) Next I% End If '-- Make sure the PyramidPics are higher in the window stack than ' WindowPic so they will appear on top of CHESS.BMP. Call SetWindowPos(ControlhWnd(WindowPic), ControlhWnd(PyramidPic(2)), 0, 0, 0, 0, (SWP_NOSIZE Or SWP_NOMOVE)) Call SetWindowPos(ControlhWnd(PyramidPic(2)), ControlhWnd(PyramidPic(1)), 0, 0, 0, 0, (SWP_NOSIZE Or SWP_NOMOVE)) Call SetWindowPos(ControlhWnd(PyramidPic(1)), ControlhWnd(PyramidPic(0)), 0, 0, 0, 0, (SWP_NOSIZE Or SWP_NOMOVE)) '-- Display the Chess demo controls. ChessPic.Visible = True ChessHelpCmdBut.Visible = True For I% = 0 To 2 PyramidPic(I%).Visible = True Next I% '---------------------------------------------------- ' SET UP THE LIST BOX CONTROLS. '---------------------------------------------------- '-- Add items to the lists. Call FillLists '-- Place the controls in their correct order. ' Meat, Veg, Fruit then Pastry. Call SetWindowPos(ControlhWnd(VegList), ControlhWnd(MeatList), 0, 0, 0, 0, (SWP_NOMOVE Or SWP_NOSIZE)) Call SetWindowPos(ControlhWnd(FruitList), ControlhWnd(VegList), 0, 0, 0, 0, (SWP_NOMOVE Or SWP_NOSIZE)) Call SetWindowPos(ControlhWnd(PastryList), ControlhWnd(FruitList), 0, 0, 0, 0, (SWP_NOMOVE Or SWP_NOSIZE)) '-- Display them. q% = DoEvents() '-- improves the way Win3 initially paints the display. MeatList.Visible = True VegList.Visible = True FruitList.Visible = True PastryList.Visible = True '-- Set Global variables to keep track of which listbox ' is on top and which list it normally comes after. TopListBox = ControlhWnd(MeatList) PrecedingListBox = GetNextWindow(TopListBox, GW_HWNDPREV) '----------------------------------------------------------------------- ' SET UP THE FIND CONTROLS. '----------------------------------------------------------------------- '-- Make the Find "dialog box" the top most child ' window of the Form, so it is *always* displayed on top of ' all other child windows. Then make it visible. q% = DoEvents() '-- improves the way Win3 initally paints the screen. Call BringWindowToTop(ControlhWnd(FindPic)) FindPic.Visible = True '-- Set standard mousepointer. Screen.MousePointer = 0 End Sub '--------------------------------------------------------------------------- ' Adds the item selected from FruitList to the ShoppingList. '--------------------------------------------------------------------------- Sub FruitList_Click () '-- Don't do anything if user just clicked to bring ' the list to the front. If ClickedToGetFocus = True Then ClickedToGetFocus = False Exit Sub End If '-- Add selected item to our shopping list. ShoppingList.AddItem FruitList.List(FruitList.ListIndex) End Sub '--------------------------------------------------------------------------- ' Displays this list on top of the other list boxes. '--------------------------------------------------------------------------- Sub FruitList_GotFocus () Call BringToTop(FruitList) End Sub '--------------------------------------------------------------------------- ' Adds the item selected from MeatList to the ShoppingList. '--------------------------------------------------------------------------- Sub MeatList_Click () '-- Don't do anything if user just clicked to bring ' the list to the front. If ClickedToGetFocus = True Then ClickedToGetFocus = False Exit Sub End If '-- Add selected item to our shopping list. ShoppingList.AddItem MeatList.List(MeatList.ListIndex) End Sub '--------------------------------------------------------------------------- ' Displays this list on top of the other list boxes. '--------------------------------------------------------------------------- Sub MeatList_GotFocus () Call BringToTop(MeatList) End Sub '--------------------------------------------------------------------------- ' Adds the item selected from PastryList to the ShoppingList. '--------------------------------------------------------------------------- Sub PastryList_Click () '-- Don't do anything if user just clicked to bring ' the list to the front. If ClickedToGetFocus = True Then ClickedToGetFocus = False Exit Sub End If '-- Add selected item to our shopping list. ShoppingList.AddItem PastryList.List(PastryList.ListIndex) End Sub '--------------------------------------------------------------------------- ' Displays this list on top of the other list boxes. '--------------------------------------------------------------------------- Sub PastryList_GotFocus () Call BringToTop(PastryList) End Sub '---------------------------------------------------------------------------- ' This is where the start of moving the small picture controls containing ' PYRAMID.BMP begins. '---------------------------------------------------------------------------- Sub PyramidPic_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) '-- Save mouse X/Y so MouseMove can determine how far ' the mouse has moved. XStart = X: YStart = Y '-- Set flag for MouseMove. OkToMovePyramidPic = True End Sub '---------------------------------------------------------------------------- ' This is the routine that actually moves the picture controls that ' contain PYRAMID.BMP. '---------------------------------------------------------------------------- Sub PyramidPic_MouseMove (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) '-- Only move the picture if the left mouse button is down. If Button = 1 Then '-- Only move the picture if no DoEvent is in progress. If OkToMovePyramidPic = True Then OkToMovePyramidPic = False PyramidPic(Index).Move (PyramidPic(Index).Left + X - XStart), (PyramidPic(Index).Top + Y - YStart) q% = DoEvents() OkToMovePyramidPic = True '-- DoEvents has finished. End If End If End Sub '--------------------------------------------------------- ' This routine sets the WS_CLIPSIBLINGS style bit for ' all child windows of the Parent window *and* any ' child windows of the child windows. The routine is ' recursive. ' *** THIS IS THE KEY ROUTINE OF THE PROGRAM. *** ' Setting the WS_CLIPSIBLINGS style bit is all that is ' needed to make VB work properly with overlapping ' controls. Or at least, so it appears to me. '-------------------------------------------------------- Sub SetClipSiblingBit (ByVal hWndParent As Integer) Dim hWndChild As Integer Dim Style As Long '-- Get the first child window. hWndChild = GetWindow(hWndParent, GW_CHILD) '-- Set the CLIPSIBLING bit for each child window. ' Loop terminates when GetWindowNext runs out of ' child windows and returns NULL. Do Style = GetWindowLong(hWndChild, GWL_STYLE) '-- Get current style. Style = Style Or WS_CLIPSIBLINGS '-- Set the bit. Style = SetWindowLong(hWndChild, GWL_STYLE, Style) '-- Set new style. '-- Process any child windows of this window. If GetWindow(hWndChild, GW_CHILD) <> 0 Then Call SetClipSiblingBit(hWndChild) '-- recursive call. End If '-- Get the next top level child window. hWndChild = GetNextWindow(hWndChild, GW_HWNDNEXT) Loop Until hWndChild = 0 End Sub '--------------------------------------------------------------------------- ' Adds the item selected from VegList to the ShoppingList. '--------------------------------------------------------------------------- Sub VegList_Click () '-- Don't do anything if user just clicked to bring ' the list to the front. If ClickedToGetFocus = True Then ClickedToGetFocus = False Exit Sub End If '-- Add selected item to our shopping list. ShoppingList.AddItem VegList.List(VegList.ListIndex) End Sub '--------------------------------------------------------------------------- ' Displays this list on top of the other list boxes. '--------------------------------------------------------------------------- Sub VegList_GotFocus () Call BringToTop(VegList) End Sub '--------------------------------------------------------- ' This control is the Parent of the ChessPic control. ' That is, ChessPic has been placed *on* this control, ' *not* on Form1. It serves as a clipping window which ' restricts the amount of ChessPic which is visible. ' NOTE that ChessPic has its AutoSize Property set to ' True, so when CHESS.BMP is loaded into its Picture ' Property, ChessPic becomes *much* larger than this ' picture control. '--------------------------------------------------------- Sub WindowPic_Click () End Sub